package com.sheng.web.controller.web;

import com.sheng.config.ApplicationContext;
import com.sheng.config.ClassPathXmlApplicationContext;
import com.sheng.service.PersonService;
import org.junit.Test;

public class PersonControllerTest {

    @Test
    public void test01() {
           /*
            1.加载了xml配置文件
            2.根据xml中bean标签中的配置信息，通过反射创建对象，并且将对象放入ioc容器中
         */
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        /*
            根据key从容器中获取对象
         */
//        IAccountDao accountDao = (IAccountDao) applicationContext.getBean("accountDao");
//        accountDao.save();
        PersonService perSonService = (PersonService) applicationContext.getBean("personService");
        perSonService.save();
    }
}
